<?php use_helper('Javascript') ?>
<div id="products">
<ul>  
<?php if(is_array($sf_user->getAttribute('cart')) && sizeof($sf_user->getAttribute('cart')) > 0) ?>
  <?php foreach ($sf_user->getAttribute('cart') as $product_id => $quantity): ?>
    <li>
      <div class="basket_product">
        <span class="amount"><?php echo $quantity ?></span>
        <span class="name"><?php echo ProductsPeer::getName($product_id) ?></span>
         <div class="desc"><?php echo image_tag(ProductsPeer::getImage($product_id), array(
      'class' => 'cart-items',
      'id'    => 'item_'.$product_id,
      'style' => 'position:relative'
    )) ?></div>
        <?php echo link_to_remote(image_tag('frontend/delete.png'), array(
          'update' => 'right_cart',
          'url'    => 'cart/removeProductAjax?id='.$product_id,
          'script'     => 'true',
          ), array('class'  => 'delete')
        ) ?>
        <?php /*echo image_tag(ProductsPeer::getImage($product_id), array(
      'class' => 'cart-items',
      'id'    => 'item_'.$product_id,
      'style' => 'position:relative'
    )) */?>
      </div>
    </li>
    <?php //echo draggable_element('item_'.$product_id, array('revert' => true)) ?>
  <?php endforeach; ?>
  <li>
    <div class="basket_product target">
      Glissez-Déposer ici vos produits !
    </div>
  </li>
</ul>
</div>
 

<div id="right_buttons">
  <ul>
    <li>
      <?php echo link_to_remote('<span class="pre">Vider la</span> Corbeille', array(
          'update' => 'right_cart',
          'url'    => 'cart/clear',
          'script'     => 'true',
          ), array('class'  => 'delete')
        ) ?>
    </li>
    <li>
      <a href="<?php echo url_for('@cart') ?>" class="save"> 
          <span class="pre">Valider mon</span> Panier
        </a>

    </li>
  </ul>
</div>

<div style="height:20px">
  <p id="indicator" style="display:none">
    <?php echo image_tag('indicator.gif') ?> updating cart...
  </p>
</div>

        <?php echo drop_receiving_element('products', array(
          'update'     => 'right_cart',
          'url'        => 'cart/add',
          'accept'     => 'products',
          'script'     => 'true',
          'loading'    => "Element.show('indicator')",
          'complete'   => "Element.hide('indicator')"
        )) ?>

        <?php /* echo drop_receiving_element('wastebin', array(
          'update'     => 'products',
          'url'        => 'cart/remove',
          'accept'     => 'cart-items',
          'script'     => 'true',
          'hoverclass' => 'wastebin-active',
          'loading'    => "Element.show('indicator')",
          'complete'   => "Element.hide('indicator')"
        )) ?>
        
        <?php echo drop_receiving_element('cart', array(
          'update'     => 'products',
          'url'        => 'cart/clear',
          'accept'     => 'broom',
          'script'     => 'true',
          'hoverclass' => 'cart-active',
          'loading'    => "Element.show('indicator')",
          'complete'   => "Element.hide('indicator')"
        )) */?>
